package jjoms.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class loginCheckInterceptor extends HandlerInterceptorAdapter {

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		System.out.println("dddd");
		HttpSession session=request.getSession(false);
		if(session==null||session.getAttribute("mvo")==null){
			System.out.println("##Interceptor 로그인체크, 비로그인 상태이므로 로그인페이지로 이동##");
			response.sendRedirect(request.getContextPath()+"/member/home.moja");
			return false; //컨트롤러 메서드 실행을 막는다. 로그인 ㄴㄴ
		}
		return true;
	}
	
}
